'https://search.bidcenter.com.cn/search?keywords=%E6%9C%8D%E5%8A%A1%E5%99%A8&mod=0&page=3'
import execjs
import requests

headers = {
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36',
}

data = {
    'from': '6137',
    'guid': '7c3d6d36-9d5f-49f5-a12f-714df6f2a609',
    'location': '6138',
    'token': '',
    'next_token': '',
    'keywords': '服务器',
    'mod': '0',
    'page': '5',
}

response = requests.post('https://interface.bidcenter.com.cn/search/GetSearchProHandler.ashx', headers=headers, data=data)
js_compile = execjs.compile(open('czw.js').read())
info_list = js_compile.call('de_aes', response.text)['other2']['listData']
for info in info_list:
    type = info['news_type_des']
    if type == '中标结果':
        d = {
            '链接':info['news_url'].lstrip("//"),
            '标题': info['news_title_show'],
            '中标金额': info['news_zhongbiaojine_show'],
            '采购方式':info['news_cgfs'],
            '时间':info['news_star_time_show'],
            '省份': info['news_diqustr'],
        }
    elif type == '招标公告':
        d = {
            '链接':info['news_url'].lstrip("//"),
            '标题': info['news_title_show'],
            '采购预算': info['news_zhongbiaojine_show'],
            '采购方式':info['news_cgfs'],
            '时间':info['news_star_time_show'],
            '省份': info['news_diqustr'],
        }
    else:
        raise ValueError('类型错误')
    print(d)